<?php namespace Phpcmf\Controllers\Admin;

/**
 * 二次开发时可以修改本文件，不影响升级覆盖
 */

class Yonghuzu extends \Phpcmf\Admin\Mform
{

    public function index() {
        
            $tid = dr_safe_filename($_GET['tid']);
            if (strlen($tid)) {
                $tid = intval($tid);
                $this->init['where_list'].= ' and tid='.$tid;
            }
            
            $this->init['order_by'] = 'displayorder ASC,inputtime ASC';
            
            $p = [
                'cid' =>  $this->cid,
                'tid' =>  $tid,
            ];
            
            $this->_List($p);
            
            //dr_debug('_app_clink', $this->_app_clink('mform'));
            
            //$stype = \Phpcmf\Service::M('content', 'zhishi')->son_type($this->index['son_type']);
            
            \Phpcmf\Service::V()->assign([
                'p' => $p,
                'stype' => $stype,
                'clink' => $this->_app_clink('mform'),
                'cbottom' => $this->_app_cbottom('mform'),
                'sname' => strlen($tid) ? $stype[$tid] : '全部',
                'menu' => \Phpcmf\Service::V()->get_value('menu').'<li> <a  href="javascript:dr_help(\'628\');"><i class="fa fa-question-circle"></i> '.dr_lang('在线帮助').'</a> <i class="fa fa-circle"></i> </li>',
            ]);
            \Phpcmf\Service::V()->display('yonghuzu_list.html');
    }

    public function add() {
        $this->_Admin_Add();
    }

    public function edit() {
        $this->_Admin_Edit();
    }

    public function show_index() {
        $this->_Admin_Show();
    }

    public function order_edit() {
        $this->_Admin_Order();
    }

    public function del() {
        $this->_Admin_Del();
    }
	public function morenadd() {
	    $tid = \Phpcmf\Service::L('input')->get('cid');
		$uid = \Phpcmf\Service::L('input')->get('uid');
		$catid = \Phpcmf\Service::L('input')->get('catid');
		$data = [
			'id'=> $tid,
			'uid'=> $uid,
			'catid'=> $catid,
		];
		dr_debug('文件名$data', $data);
		d_moren_huiyuanzu_add($data);
		$this->_msg(1, '添加成功');
	}
}
